Change in openvpn[master]: Persist-key: enable persist-key option by default
A message that is not in the archive (sent off-list or not yet received): gerrit.1708351044000.I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
to review the following change.
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
This commit changes the default behavior of the OpenVPN configuration to enable the persist-key option by default.
This means that all the key file content will be kept in memory throughout the lifetime of the VPN connection.
---
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-config-files/tls-home.conf
M sample/sample-config-files/tls-office.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
15 files changed, 24 insertions(+), 48 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/1
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Removed in OpenVPN 2.7. Corresponding behavior is now always enabled.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +0 -1
@@ -278,7 +278,6 @@ # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-config-files/tls-home.conf +0 -1
@@ -73,7 +73,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-config-files/tls-office.conf +0 -1
@@ -76,7 +76,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +3 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3635,6 +3627,7 @@ } } +struct context_buffers *init_context_buffers (const struct frame *frame) {
@@ -3857,7 +3850,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3859,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +12 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,10 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored." +"The corresponding behavior is now always enabled." +"This option will be removed in a future version, " +"please remove it from your configuration." ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 1: Code-Review-1
(6 comments)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/99bc33fe_177eba51 :
PS1, Line 9: This commit changes the default behavior of the OpenVPN
Nitpick: just use "Change the default behavior". "This commit" is redundant and clunky.
Patchset:
PS1:
Functionally looks good to me. Some documentation improvements suggested.
File doc/man-sections/signals.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/4c986d46_e82cde2f :
PS1, Line 13: remote IP address/port based on ``--persist-tun``, ``--persist-local-ip``
Trailing whitespace
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/8164c8c9_a1ae98fb :
PS1, Line 47: Removed in OpenVPN 2.7. Corresponding behavior is now always enabled.
"Corresponding behavior" is very vague. Let's write "Keys are now always persisted across restarts" or something like that.
File sample/sample-config-files/server.conf:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/910d57b4_d0613104 :
PS1, Line 277: # The persist options will try to avoid
Nitpick: "The persist options" not correct anymore, since it is only one option now 😊
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/a6f6455c_7e115ef1 :
PS1, Line 6963: "The corresponding behavior is now always enabled."
Same comment about "corresponding behavior"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Tue, 20 Feb 2024 13:42:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the key file content will be kept in memory throughout the lifetime of the VPN connection.
---
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-config-files/tls-home.conf
M sample/sample-config-files/tls-office.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
15 files changed, 25 insertions(+), 49 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/2
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Removed in OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-config-files/tls-home.conf +0 -1
@@ -73,7 +73,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-config-files/tls-office.conf +0 -1
@@ -76,7 +76,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +3 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3635,6 +3627,7 @@ } } +struct context_buffers *init_context_buffers (const struct frame *frame) {
@@ -3857,7 +3850,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3859,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +12 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,10 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored." +"Keys are now always persisted across restarts." +"This option will be removed in a future version, " +"please remove it from your configuration." ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 1:
(5 comments)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/e10934a7_2866e37f :
PS1, Line 9: This commit changes the default behavior of the OpenVPN
Quoted 1 line
Nitpick: just use "Change the default behavior". "This commit" is redundant and clunky.
Done
File doc/man-sections/signals.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/cd5281ba_35c80d22 :
PS1, Line 13: remote IP address/port based on ``--persist-tun``, ``--persist-local-ip``
Quoted 1 line
Trailing whitespace
Done
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/ffcf9cec_929ec0cd :
PS1, Line 47: Removed in OpenVPN 2.7. Corresponding behavior is now always enabled.
Quoted 1 line
"Corresponding behavior" is very vague. […]
Done
File sample/sample-config-files/server.conf:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/4fe0fe2f_2a0c3f24 :
PS1, Line 277: # The persist options will try to avoid
Quoted 1 line
Nitpick: "The persist options" not correct anymore, since it is only one option now 😊
Done
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/489e0245_c52b6bdb :
PS1, Line 6963: "The corresponding behavior is now always enabled."
Quoted 1 line
Same comment about "corresponding behavior"
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 20 Feb 2024 14:10:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, its_Giaan.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 2:
(4 comments)
Patchset:
PS2:
An entry in Changes.rst is missing.
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/eb5579c0_cf2fe0e5 :
PS2, Line 47: Removed in OpenVPN 2.7. Keys are now always persisted across restarts.
Maybe use "Ignored" since OpenVPN 2.7?
File src/openvpn/init.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/cab1614e_ebf8f6bc :
PS2, Line 3630:
random whitespace change
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/6f595c78_b2ccf3fe :
PS2, Line 6965: "please remove it from your configuration.");
I don't think we should/warn or threaten to remove that option. That just makes configuration files incompatible in the future without a good reason to do so. For other options like max-routes, we also just ignore them.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 04 Mar 2024 16:31:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 2:
(4 comments)
Patchset:
PS2:
Quoted 1 line
An entry in
Changes.rstis missing.
Acknowledged
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/3e92e860_85f89117 :
PS2, Line 47: Removed in OpenVPN 2.7. Keys are now always persisted across restarts.
Quoted 1 line
Maybe use "Ignored" since OpenVPN 2. […]
Acknowledged
File src/openvpn/init.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/5d665ab1_8651ae42 :
PS2, Line 3630:
Quoted 1 line
random whitespace change
Acknowledged
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/3677f02f_e3f89e35 :
PS2, Line 6965: "please remove it from your configuration.");
Quoted 1 line
I don't think we should/warn or threaten to remove that option. […]
We do exactly the same with max-routes, the only difference is that with persist-key we check for permission.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 05 Mar 2024 08:30:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
to look at the new patch set (#3).
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
---
M Changes.rst
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-config-files/tls-home.conf
M sample/sample-config-files/tls-office.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
16 files changed, 24 insertions(+), 49 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/3
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-config-files/tls-home.conf +0 -1
@@ -73,7 +73,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-config-files/tls-office.conf +0 -1
@@ -76,7 +76,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/529/comment/e97d1f12_d1a2e525 :
PS2, Line 6965: "please remove it from your configuration.");
Quoted 1 line
We do exactly the same with max-routes, the only difference is that with persist-key we check for pe […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 05 Mar 2024 12:55:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: its_Giaan <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, its_Giaan.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 05 Mar 2024 13:29:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Persist-key: enable persist-key option by default
In reply to a message not in the archiveFrom: itsGiaan <[email protected]...>
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/529
This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-config-files/tls-home.conf +0 -1
@@ -73,7 +73,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-config-files/tls-office.conf +0 -1
@@ -76,7 +76,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
Attention is currently required from: flichtenheld, its_Giaan.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
to look at the new patch set (#4).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
---
M Changes.rst
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-config-files/tls-home.conf
M sample/sample-config-files/tls-office.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
16 files changed, 24 insertions(+), 49 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/4
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-config-files/tls-home.conf +0 -1
@@ -73,7 +73,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-config-files/tls-office.conf +0 -1
@@ -76,7 +76,6 @@ ; ping-restart 45 ; ping-timer-rem ; persist-tun -; persist-key # Verbosity level. # 0 -- quiet except for fatal errors.
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
---
M Changes.rst
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
14 files changed, 24 insertions(+), 47 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/5
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
PATCH v5 1/1 Persist-key: enable persist-key option by default
In reply to a message not in the archiveFrom: Gianmarco De Gregori <[email protected]...>
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/529
This mail reflects revision 5 of this Change. Acked-by according to Gerrit (reflected above):
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
[Openvpn-devel] [PATCH applied] Re: Persist-key: enable persist-key option by default
Thanks for this. We discussed this and nobody seemed to remember why persist-key was configurable really ("you could swap out the key + cert while openvpn is running and then SIGUSR1 it", but yeah, who does this?)
- so thanks for throwing out these extra code paths.
Tested with the full server/client rig.
Your patch has been applied to the master branch.
commit 802fcce5448741bb1e34dd06ac3674b6b6c55a94
Author: Gianmarco De Gregori Date: Thu Mar 7 15:03:55 2024 +0100
Persist-key: enable persist-key option by default
Signed-off-by: Gianmarco De Gregori <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28347.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#6) to the change originally created by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
Trac: #1405
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28347.html
---
M Changes.rst
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
14 files changed, 24 insertions(+), 47 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/529/6
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/529?usp=email )
Change subject: Persist-key: enable persist-key option by default
......................................................................
Persist-key: enable persist-key option by default
Change the default behavior of the OpenVPN configuration by enabling the persist-key option by default.
This means that all the keys will be kept in memory across restart.
Trac: #1405
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28347.html
---
M Changes.rst
M doc/man-sections/connection-profiles.rst
M doc/man-sections/generic-options.rst
M doc/man-sections/link-options.rst
M doc/man-sections/server-options.rst
M doc/man-sections/signals.rst
M doc/man-sections/unsupported-options.rst
M sample/sample-config-files/client.conf
M sample/sample-config-files/server.conf
M sample/sample-windows/sample.ovpn
M src/openvpn/init.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
14 files changed, 24 insertions(+), 47 deletions(-)
Changes.rst +2 -0
@@ -20,6 +20,8 @@ When configured to authenticate with NTLMv1 (``ntlm`` keyword in ``--http-proxy``) OpenVPN will try NTLMv2 instead. +``persist-key`` option has been enabled by default. + All the keys will be kept in memory across restart. Overview of changes in 2.6 ==========================
doc/man-sections/connection-profiles.rst +0 -1
@@ -39,7 +39,6 @@ http-proxy 192.168.0.8 8080 </connection> - persist-key persist-tun pkcs12 client.p12 remote-cert-tls server
doc/man-sections/generic-options.rst +1 -12
@@ -302,17 +302,6 @@ Change process priority after initialization (``n`` greater than 0 is lower priority, ``n`` less than zero is higher priority). ---persist-key - Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``. - - This option can be combined with ``--user`` to allow restarts - triggered by the :code:`SIGUSR1` signal. Normally if you drop root - privileges in OpenVPN, the daemon cannot be restarted since it will now - be unable to re-read protected key files. - - This option solves the problem by persisting keys across :code:`SIGUSR1` - resets, so they don't need to be re-read. - --providers providers Load the list of (OpenSSL) providers. This is mainly useful for using an external provider for key management like tpm2-openssl or to load the
@@ -402,7 +391,7 @@ Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really - consider using the ``--persist-key`` and ``--persist-tun`` options. + consider using the ``--persist-tun`` option. --status args Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
doc/man-sections/link-options.rst +1 -1
@@ -283,7 +283,7 @@ See the signals section below for more information on :code:`SIGUSR1`. Note that the behavior of ``SIGUSR1`` can be modified by the - ``--persist-tun``, ``--persist-key``, ``--persist-local-ip`` and + ``--persist-tun``, ``--persist-local-ip`` and ``--persist-remote-ip`` options. Also note that ``--ping-exit`` and ``--ping-restart`` are mutually
doc/man-sections/server-options.rst +1 -1
@@ -452,7 +452,7 @@ ``--route``, ``--route-gateway``, ``--route-delay``, ``--redirect-gateway``, ``--ip-win32``, ``--dhcp-option``, ``--dns``, ``--inactive``, ``--ping``, ``--ping-exit``, ``--ping-restart``, - ``--setenv``, ``--auth-token``, ``--persist-key``, ``--persist-tun``, + ``--setenv``, ``--auth-token``, ``--persist-tun``, ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout``
doc/man-sections/signals.rst +2 -3
@@ -10,9 +10,8 @@ Like :code:`SIGHUP``, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated - remote IP address/port based on ``--persist-tun``, ``--persist-key``, - ``--persist-local-ip`` and ``--persist-remote-ip`` options respectively - (see above). + remote IP address/port based on ``--persist-tun``, ``--persist-local-ip`` + and ``--persist-remote-ip`` options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the ``--ping-restart`` option.
doc/man-sections/unsupported-options.rst +3 -0
@@ -42,3 +42,6 @@ --prng Removed in OpenVPN 2.6. We now always use the PRNG of the SSL library. + +--persist-key + Ignored since OpenVPN 2.7. Keys are now always persisted across restarts.
sample/sample-config-files/client.conf +0 -1
@@ -62,7 +62,6 @@ ;group openvpn # Try to preserve some state across restarts. -persist-key persist-tun # If you are connecting through an
sample/sample-config-files/server.conf +1 -2
@@ -274,11 +274,10 @@ ;user openvpn ;group openvpn -# The persist options will try to avoid +# The persist option will try to avoid # accessing certain resources on restart # that may no longer be accessible because # of the privilege downgrade. -persist-key persist-tun # Output a short status file showing
sample/sample-windows/sample.ovpn +0 -1
@@ -89,7 +89,6 @@ ; ping-restart 60 ; ping-timer-rem ; persist-tun -; persist-key ; resolv-retry 86400 # keep-alive ping
src/openvpn/init.c +2 -10
@@ -3559,14 +3559,6 @@ {msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail" ); } -if (!o->persist_key -#ifdef ENABLE_PKCS11 - && !o->pkcs11_id -#endif - ) - { -msg (M_WARN ,"WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail" ); - } }if (o->chroot_dir && !(o->username && o->groupname))
@@ -3857,7 +3849,7 @@ do_close_free_key_schedule(struct context *c, bool free_ssl_ctx) {/* -* always free the tls_auth/crypt key. If persist_key is true, the key will +* always free the tls_auth/crypt key. The key will * be reloaded from memory (pre-cached) */ free_key_ctx (&c->c1.ks.tls_crypt_v2_server_key);
@@ -3866,7 +3858,7 @@buf_clear (&c->c1.ks.tls_crypt_v2_wkc);free_buf (&c->c1.ks.tls_crypt_v2_wkc); -if (!(c->sig->signal_received ==SIGUSR1 && c->options.persist_key)) +if (!(c->sig->signal_received ==SIGUSR1 )) {key_schedule_free (&c->c1.ks, free_ssl_ctx); }
src/openvpn/openvpn.h +1 -1
@@ -48,7 +48,7 @@/* * Our global key schedules, packaged thusly -* to facilitate --persist-key. +* to facilitate key persistence. */ struct key_schedule
src/openvpn/options.c +10 -13
@@ -273,7 +273,6 @@"--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n" "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n" -"--persist-key : Don't re-read key files across SIGUSR1 or --ping-restart.\n" #if PASSTOS_CAPABILITY"--passtos : TOS passthrough (applies to IPv4 only).\n" #endif
@@ -1857,7 +1856,6 @@SHOW_BOOL (persist_tun);SHOW_BOOL (persist_local_ip);SHOW_BOOL (persist_remote_ip); -SHOW_BOOL (persist_key);#if PASSTOS_CAPABILITY SHOW_BOOL (passtos);
@@ -3240,18 +3238,16 @@ ce->tls_crypt_v2_file_inline = o->tls_crypt_v2_file_inline; } -/* Pre-cache tls-auth/crypt(-v2) key file if persist-key was specified and +/* Pre-cache tls-auth/crypt(-v2) key file if * keys were not already embedded in the config file. */ -if (o->persist_key) - { -connection_entry_preload_key (&ce->tls_auth_file, - &ce->tls_auth_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_file, - &ce->tls_crypt_file_inline, &o->gc); -connection_entry_preload_key (&ce->tls_crypt_v2_file, - &ce->tls_crypt_v2_file_inline, &o->gc); - } +connection_entry_preload_key (&ce->tls_auth_file, + &ce->tls_auth_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_file, + &ce->tls_crypt_file_inline, &o->gc); +connection_entry_preload_key (&ce->tls_crypt_v2_file, + &ce->tls_crypt_v2_file_inline, &o->gc); +if (!proto_is_udp (ce->proto) && ce->explicit_exit_notification) {
@@ -6963,7 +6959,8 @@else if (streq (p[0 ],"persist-key" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_PERSIST ); - options->persist_key = true; +msg (M_WARN ,"DEPRECATED: --persist-key option ignored. " +"Keys are now always persisted across restarts. " ); }else if (streq (p[0 ],"persist-local-ip" ) && !p[1 ]) {
src/openvpn/options.h +0 -1
@@ -344,7 +344,6 @@bool persist_tun;/* Don't close/reopen TUN/TAP dev on SIGUSR1 or PING_RESTART */ bool persist_local_ip;/* Don't re-resolve local address on SIGUSR1 or PING_RESTART */ bool persist_remote_ip;/* Don't re-resolve remote address on SIGUSR1 or PING_RESTART */ -bool persist_key;/* Don't re-read key files on SIGUSR1 or PING_RESTART */ #if PASSTOS_CAPABILITY bool passtos;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/529?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I57f1c2ed42bd9dfd43577238749a9b7f4c1419ff
Gerrit-Change-Number: 529
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged